package com.wtwd.campus.receiver;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.wtwd.campus.annotation.MsgType;
import com.wtwd.campus.common.Constants;
import com.wtwd.campus.constant.DeviceAppFlagEnum;
import com.wtwd.campus.dao.CommandRecordMapper;
import com.wtwd.campus.entity.*;
import com.wtwd.campus.h5_manager.entity.DeviceLog;
import com.wtwd.campus.h5_manager.service.DeviceLogService;
import com.wtwd.campus.service.*;
import com.wtwd.campus.utils.CommandSendUtils;
import com.wtwd.campus.utils.ReceiverUtils;
import com.wtwd.campus.vcom.common.Constant;
import com.wtwd.campus.vcom.entity.VcomPhoneData;
import com.wtwd.campus.vcom.entity.VcomRequestRecord;
import com.wtwd.campus.vcom.service.RequestRecordService;
import com.wtwd.campus.vcom.service.VcomDeviceInfoService;
import com.wtwd.campus.vcom.service.VcomPhoneService;
import com.wtwd.campus.vcom.utils.VcomPushUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * @Author ldaoliang
 * @Date create in 10:48 2021/6/18
 * @Description
 */

@Service
@MsgType(value = Constants.HEARTBEAT)
public class HeartBeatReceiverHandler implements IReceiverHandler {

    private static final Logger logger = LoggerFactory.getLogger(HeartBeatReceiverHandler.class);
    @Autowired
    private IRMFeignClientService irmFeignClientService;
    @Autowired
    private DeviceInfoService deviceInfoService;
    @Autowired
    private ReceiverUtils receiverUtils;
    @Autowired
    private WarningRecordService warningRecordService;
    @Resource
    private CommandRecordMapper commandRecordMapper;
    @Autowired
    private CommandSendUtils commandSendUtils;
    @Autowired
    private RedisService redisService;
    @Autowired
    private VcomDeviceInfoService vcomDeviceInfoService;
    @Autowired
    private RequestRecordService requestRecordService;
    @Autowired
    private VcomPushUtils vcomPushUtils;
    @Autowired
    private RequestRecordService recordService;
    @Autowired
    private VcomPhoneService vcomPhoneService;
    @Autowired
    private DeviceLogService deviceLogService;
    @Autowired
    private DeviceFlagService deviceFlagService;
    @Autowired
    private DeviceAppService deviceAppService;


    @Override
    public void handlerMessage(MqMessage mqMessage) {
        MqHeartBeatMessage mqHeartBeatMessage = (MqHeartBeatMessage) mqMessage.getObject();
        String imei = mqHeartBeatMessage.getImei();
        String commandNumber = mqHeartBeatMessage.getCommandNumber();
        //处理指令回复的时间
        String deviceDate = mqHeartBeatMessage.getDeviceDate();
        String deviceTime = mqHeartBeatMessage.getDeviceTime();
        Long time = getTime(deviceDate, deviceTime);
        DeviceInfo deviceInfo = deviceInfoService.getDeviceByImei(imei);
        if (deviceInfo == null) {
            saveUnInStorage(imei);
            receiverUtils.cloaseChannel(imei);
            return;
        }

        // 定位数据处理
        if (mqHeartBeatMessage.getMqLocationData() == null) {//为定位心跳包
            // 进行指令的回复
            irmFeignClientService.replyKA(imei, commandNumber);
            //存储设备接收日志
            DeviceLog deviceLog = new DeviceLog();
            deviceLog.setSendUser(Constants.DEVICE_USER);
            deviceLog.setImei(imei);
            deviceLog.setBigType(Constants.NOT_LOCATE_HEART);
            JSONObject contant = new JSONObject();
            contant.put("设备号", imei);
            contant.put("电量", mqHeartBeatMessage.getBattery());
            contant.put("日期", mqHeartBeatMessage.getDeviceDate());
            contant.put("时间", mqHeartBeatMessage.getDeviceTime());
            contant.put("lbs信息", mqHeartBeatMessage.getLbsInfo());
            contant.put("步数", mqHeartBeatMessage.getStepNum());
            contant.put("设备状态", mqHeartBeatMessage.getDeviceStatus());
            deviceLog.setCmd(contant.toJSONString());
            deviceLog.setSendTime(System.currentTimeMillis());
            deviceLog.setCommandNumber(commandNumber);
            deviceLog.setState(1);
            deviceLogService.addDeviceLog(deviceLog);
        } else {  // 带定位心跳。也需要注意，定位数据可能为0
            if (mqHeartBeatMessage.getMqLocationData().getLatitude() != 0 && mqHeartBeatMessage.getMqLocationData().getLongitude() != 0) {
                //进行定位数据存储以及围栏告警记录的存储
                deviceInfo = receiverUtils.dealLocation(mqHeartBeatMessage.getMqLocationData(), time, deviceInfo, 1);
                LocationDataVo locationDataVo = new LocationDataVo();
                locationDataVo.setLocationType(1);
                locationDataVo.setLatitude(mqHeartBeatMessage.getMqLocationData().getLatitude().toString());
                locationDataVo.setLongitude(mqHeartBeatMessage.getMqLocationData().getLongitude().toString());
                locationDataVo.setAddress(deviceInfo.getAddress());
                locationDataVo.setImei(imei);
                locationDataVo.setLocationTime(time);
            }
            //存储设备接收日志
            DeviceLog deviceLog = new DeviceLog();
            deviceLog.setSendUser(Constants.DEVICE_USER);
            deviceLog.setImei(imei);
            deviceLog.setBigType(Constants.LOCATE_HEART);
            JSONObject contant = new JSONObject();
            contant.put("设备号", imei);
            contant.put("电量", mqHeartBeatMessage.getBattery());
            contant.put("日期", mqHeartBeatMessage.getDeviceDate());
            contant.put("时间", mqHeartBeatMessage.getDeviceTime());
            contant.put("lbs信息", mqHeartBeatMessage.getLbsInfo());
            contant.put("步数", mqHeartBeatMessage.getStepNum());
            contant.put("设备状态", mqHeartBeatMessage.getMqLocationData().getLongitude());
            contant.put("经度", mqHeartBeatMessage.getMqLocationData().getLatitude());
            deviceLog.setCmd(contant.toJSONString());
            deviceLog.setSendTime(System.currentTimeMillis());
            deviceLog.setCommandNumber(commandNumber);
            deviceLog.setState(1);
            deviceLogService.addDeviceLog(deviceLog);
        }
        //修改设备信息
        deviceInfo.setBattery(mqHeartBeatMessage.getBattery());
        deviceInfo.setLastUpTime((new Date()).getTime());
        deviceInfoService.modifyDeviceInfo(deviceInfo);

        // 针对发送次数达到上限的指令，在指令下发记录中置为失败处理。
        List<String> failedCmdList = mqHeartBeatMessage.getFailedCmdList();
        dealFailedCmd(deviceInfo, failedCmdList);

        // 针对离线缓存的指令，进行构建和发送
        // 1.查询该设备所有的离线存储指令
        List<Map<String, Object>> offLineRecord = deviceInfoService.getOffLineBufferCmd(imei);
        // 2.根据对应的类型构建成对应的对象，并且发送（可以调用CommandSendUtils,因为已经在线了，是否在线字段传true）
        if (offLineRecord != null && offLineRecord.size() != 0) {
            for (Map<String, Object> record : offLineRecord) {
                String type = (String) record.get("cmd");
                String param = (String) record.get("param");
                Integer userId = (Integer) record.get("user_id");
                Integer offlineId = (Integer) record.get("id");
                CommandRecord commandRecord = commandRecordMapper.getCommandRecordByOfflineId(offlineId);
                if (commandRecord != null) {
                    logger.info("心跳接收，设备重发指令,type,param,imei,commandNumber", type, param, imei, commandNumber);
                    commandSendUtils.sendOffLineCommand(type, param, imei, userId, commandRecord.getCommandNumber());
                }
            }
        }
        // 3.清空离线缓存表的指令（或者说查询出来就删除）
        deviceInfoService.deleteOffLineBufferCmd(imei);

        // TODO 获取指令威科姆的后面的指令，进行重发
        if (deviceInfo.getDeviceType() == Constants.VCOM_DEVICE) {
            if (failedCmdList != null && failedCmdList.size() != 0) {
                dealVcomFailedCmd(deviceInfo, failedCmdList);
            }
        }

    }

    /**
     * 解析指令
     *
     * @param data
     * @return
     */
    public List<Integer> parseCommand(String data) {
        String[] split = data.split(",");
        int length = split.length;
        int index = (length - 4) / 7;//总的长度减去指令中其他信息，算出有几组号码信息
        //存放所有的亲情号码信息
        List<Integer> sequenceList = new ArrayList<>();
        for (int j = 1; j <= index; j++) {
            sequenceList.add(Integer.parseInt(split[3 + (j - 1) * 7 + 1]));
        }
        return sequenceList;
    }

    public void dealFailedCmd(DeviceInfo deviceInfo, List<String> failedCmd) {
        if (failedCmd != null && failedCmd.size() != 0) {
            for (String str : failedCmd) {
                String cmd = str.split("-")[0];
                String commandNumber2 = str.split("-")[1];
                CommandRecord record = new CommandRecord();
                record.setCommandNumber(commandNumber2);
                record.setDeviceImei(deviceInfo.getImei());
                record.setCommandType(cmd);
                record.setResult(Constants.COMMAND_FAILED);
                // 因为课堂模式、白名单发的指令的cmd是同一个，但是操作对应有增删改。因此如果是这几种，需要单独处理
                if (cmd.equalsIgnoreCase(Constants.SINGLE_WHITELIST_NUMBER)) {
                    // 白名单单笔设置
                    String sequence = str.split("-")[2];
                    record.setSequence(Integer.parseInt(sequence));
                    commandRecordMapper.modifyCommandRecordResultByCondition(record);
                    //根据设备id和序列号拿到亲情号记录
                    Integer status = commandRecordMapper.getDeviceWhiteListByCondition(deviceInfo.getDeviceId(), Integer.parseInt(sequence));
                    if (status != null) {
                        if (status == Constants.WHITE_PATTERN_STAY_ADD) {
                            //如果是待添加，则删除那笔数据
                            commandRecordMapper.delWhiteByCondition(deviceInfo.getDeviceId(), Integer.parseInt(sequence), Constants.WHITE_PATTERN_STAY_ADD);
                        } else {
                            //把状态改为正常
                            commandRecordMapper.completeDeviceWhiteStatus(deviceInfo.getDeviceId(), Integer.parseInt(sequence), Constants.WHITE_PATTERN_NORMAl);
                        }
                    }
                } else if (cmd.equalsIgnoreCase(Constants.SET_NO_DISTURB_TIME)) {
                    //课堂模式设置
                    String sequence = str.split("-")[2];
                    record.setSequence(Integer.parseInt(sequence));
                    commandRecordMapper.modifyCommandRecordResultByCondition(record);
                    //根据设备id和序列号拿到课堂模式记录状态
                    Integer status = commandRecordMapper.getDeviceClassPatternByCondition(deviceInfo.getDeviceId(), Integer.parseInt(sequence));
                    if (status != null) {
                        if (status == Constants.CLASSES_PATTERN_STAY_ADD) {
                            //删除这一笔课堂模式
                            commandRecordMapper.delDeviceClassPatternByCondition(deviceInfo.getDeviceId(), Integer.parseInt(sequence));
                        } else {
                            //把状态改为正常
                            commandRecordMapper.completeDeviceClassPatternStatus(deviceInfo.getDeviceId(), Integer.parseInt(sequence), Constants.CLASSES_PATTERN_NORMAl);
                        }
                    }
                } else if (cmd.equalsIgnoreCase(Constants.ALL_WHITELIST_NUMBER)) {
                    // TODO 兼容威科姆的指令（SOS、亲情号、白名单）
                    //将操作记录表中指令的结果改为失败
                    commandRecordMapper.modifyCommandRecordResult(record);
                    //如果是一次性设置所有
                    //首先从redis中查询到该记录
                    Map<String, Object> commands = redisService.getCommandsByImei(deviceInfo.getImei());
                    if (commands != null) {
                        String commandStr = (String) commands.get(str);
                        int i = commandStr.indexOf(",");
                        String substring = commandStr.substring(i + 1, commandStr.length() - 1);
                        Command command = JSONObject.parseObject(substring, Command.class);
                        String content = command.getContent();
                        //获取本次操作的所有白名单的sequence
                        List<Integer> sequences = parseCommand(content);
                        //根据sequence和设备id和状态为添加的。删除记录
                        commandRecordMapper.delWhiteListByCondition(deviceInfo.getDeviceId(), Constants.WHITE_PATTERN_STAY_ADD, sequences);
                        //将其他待状态的记录设置为正常状态
                        commandRecordMapper.updateWhiteListStatusByCondition(deviceInfo.getDeviceId(), Constants.WHITE_PATTERN_NORMAl, sequences);
                        //将redis中的存储指令删除
                        redisService.deleteCommand(deviceInfo.getImei(), str);
                    }
                } else if (cmd.equalsIgnoreCase(Constants.APP_INSTALLATION)) {//重发三次失败过后,将开关置为失败处理
                    deviceFlagService.setAppInstallationFlag(deviceInfo.getDeviceId(), DeviceAppFlagEnum.FILE.getFlag());
                    commandRecordMapper.modifyCommandRecordResult(record);
                } else if (cmd.equalsIgnoreCase(Constants.APP_DISABLE)) {
                    cmd = str.split("-")[0];
                    String packageName = str.split("-")[1];
                    commandNumber2 = str.split("-")[2];
                    record.setCommandNumber(commandNumber2);
                    record.setCommandType(cmd.concat("-").concat(packageName));
                    deviceAppService.updateAppDisableFlag(deviceInfo.getDeviceId(), packageName, DeviceAppFlagEnum.FILE.getFlag());
                    commandRecordMapper.modifyCommandRecordResult(record);
                } else if (cmd.equalsIgnoreCase(Constants.LOCK_CARD)) {//锁卡状态回退
                    deviceFlagService.lockCardRollBack(deviceInfo.getDeviceId());
                } else if (cmd.equalsIgnoreCase(Constants.LOCK_DEVICE)) {//锁卡状态回退
                    deviceFlagService.lockDeviceRollBack(deviceInfo.getDeviceId());
                }
                if (cmd.equalsIgnoreCase(Constants.LOCK_NET)) {//锁网指令回退
                    deviceFlagService.lockNetRollBack(deviceInfo.getDeviceId());
                } else {  // 其他
                    //将操作记录表中指令的结果改为失败
                    commandRecordMapper.modifyCommandRecordResult(record);
                }
            }
        }
    }

    public void dealVcomFailedCmd(DeviceInfo deviceInfo, List<String> failedCmd) {
        if (failedCmd != null && failedCmd.size() != 0) {
            for (String str : failedCmd) {
                String cmd = str.split("-")[0];
                String commandNumber = str.split("-")[1];
                //威科姆免打扰失败处理
                if (cmd.equalsIgnoreCase(Constants.VCOM_NOT_DISTURB)) {
                    boolean b = vcomDeviceInfoService.dealFailedDotDisturb(deviceInfo.getImei(), commandNumber);
                    if (b) {
                        Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.COMMAND_TYPE_NOT_DISTURB);
                        if (map != null) {
                            //将该请求状态改为失败(暂定为2(认为正常))
                            int id = (int) map.get("id");
//                            recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                            VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.COMMAND_TYPE_NOT_DISTURB);
                            if (nextSendCommand != null) {
                                vcomDeviceInfoService.setNotDisturbData(nextSendCommand);
                            }
                            // 推送requestId结果
                            vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_NOT_DISTURB, deviceInfo.getImei());
                            //将指令重置为失败状态
                            recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                        }
                    }
                } else if (cmd.equals(Constants.VCOM_SHORT_MESSAGE)) {
                    Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.COMMAND_TYPE_SHORT_MESSAGE);
                    if (map != null) {
                        //将该请求状态改为失败(暂定为2(认为正常))
                        int id = (int) map.get("id");
                        VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.COMMAND_TYPE_SHORT_MESSAGE);
                        if (nextSendCommand != null) {
                            vcomDeviceInfoService.sendShortMessage(nextSendCommand);
                        }
                        // 推送requestId结果
                        vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_SHORT_MESSAGE, deviceInfo.getImei());
                        recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                    }
                } else if (cmd.equals(Constants.VCOM_NOTICE_MESSAGE)) {
                    Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.COMMAND_TYPE_MESSAGE);
                    if (map != null) {
                        //将该请求状态改为失败(暂定为2(认为正常))
                        int id = (int) map.get("id");
                        VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.COMMAND_TYPE_MESSAGE);
                        if (nextSendCommand != null) {
                            vcomDeviceInfoService.sendMessage(nextSendCommand);
                        }
                        // 推送requestId结果
                        vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_MESSAGE, deviceInfo.getImei());
                        recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                    }
                } else if (cmd.equals(Constants.ALL_SOS_PHONE)) {
                    // TODO 标识为失败，跟消息，短消息做类似的处理，并且vcom_phone_data表中的数据进行还原成old_data
                    // 找到requestId对应的imei和type，回到vcom_phone_data上，回退data的数据。并且往下发下一条
                    vcomPhoneService.fallBackPhone(deviceInfo.getImei(), commandNumber);
                    Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.COMMAND_TYPE_SOS);
                    if (map != null) {
                        //将该请求状态改为失败(暂定为2(认为正常))
                        int id = (int) map.get("id");
                        VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.COMMAND_TYPE_SOS);
                        if (nextSendCommand != null) {
                            String commandValue = nextSendCommand.getRequestContent();
                            JSONArray sosNoArray = JSON.parseArray(commandValue);
                            vcomDeviceInfoService.useDealSos(sosNoArray, nextSendCommand);
                        }
                        // 推送requestId结果
                        vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_SOS, deviceInfo.getImei());
                        recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                    }
                } else if (cmd.equals(Constants.ALL_WHITELIST_NUMBER)) {
                    // TODO 标识为失败，跟消息，短消息做类似的处理，并且vcom_phone_data表中的数据进行还原成old_data
                    // 找到requestId对应的imei和type，回到vcom_phone_data上，回退data的数据。并且往下发下一条
                    VcomPhoneData vcomPhoneData = vcomPhoneService.getVcomPhoneByImeiAndCommandNumber(deviceInfo.getImei(), commandNumber);
                    if (vcomPhoneData != null) {
                        if (vcomPhoneData.getType().equals(Constant.PHONE_FAMILY)) {//亲情号
                            Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.PHONE_FAMILY);
                            if (map != null) {
                                //回退手机号，状态
                                vcomPhoneService.fallBackPhone(deviceInfo.getImei(), commandNumber);
                                //将该请求状态改为失败(暂定为2(认为正常))
                                VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.PHONE_FAMILY);
                                if (nextSendCommand != null) {
                                    String commandValue = nextSendCommand.getRequestContent();
                                    JSONArray sosNoArray = JSON.parseArray(commandValue);
                                    vcomDeviceInfoService.useDealFamilyNo(sosNoArray, nextSendCommand);
                                }
                                vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_FAMILY_NO, deviceInfo.getImei());
                                recordService.updateVcomRequestStateById((int) map.get("id"), Constant.STATUS_FAILED);
                            }

                        } else if (vcomPhoneData.getType().equals(Constant.PHONE_WHITE)) {//白名单
                            Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.PHONE_WHITE);
                            if (map != null) {
                                //回退手机号，状态
                                vcomPhoneService.fallBackPhone(deviceInfo.getImei(), commandNumber);
                                //将该请求状态改为失败(暂定为2(认为正常))
                                VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.PHONE_WHITE);
                                if (nextSendCommand != null) {
                                    String commandValue = nextSendCommand.getRequestContent();
                                    JSONArray sosNoArray = JSON.parseArray(commandValue);
                                    vcomDeviceInfoService.useDealWhiteNo(sosNoArray, nextSendCommand);
                                }
                                vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_TYPE_WHITE_LIST, deviceInfo.getImei());
                                recordService.updateVcomRequestStateById((int) map.get("id"), Constant.STATUS_FAILED);
                            }

                        }
                    }
                } else if (cmd.equals(Constants.FACTORY_RESET)) {
                    Map<String, Object> map = requestRecordService.getRequestRecordByCondition(deviceInfo.getImei(), commandNumber, Constant.COMMAND_FACTORY_RESET);
                    if (map != null) {
                        //将该请求状态改为失败(暂定为2(认为正常))
                        int id = (int) map.get("id");
                        VcomRequestRecord nextSendCommand = requestRecordService.getNextSendCommand(deviceInfo.getImei(), (String) map.get("request_id"), Constant.COMMAND_FACTORY_RESET);
                        if (nextSendCommand != null) {
                            vcomDeviceInfoService.factoryDataReset(deviceInfo.getImei(), nextSendCommand.getCommandNumber());
                        }
                        // 推送requestId结果
                        vcomPushUtils.pushAndUpdateRequestStatus((int) map.get("id"), (String) map.get("request_id"), Constant.STATUS_FAILED, Constant.COMMAND_FACTORY_RESET, deviceInfo.getImei());
                        recordService.updateVcomRequestStateById(id, Constant.STATUS_FAILED);
                    }

                }
            }
        }
    }

    public static void main(String[] args) {
        String[] split = "*WT,868976030203477,PBWLALL,114326,7,12345678899,1,0,\\\\u0053\\\\u0046\\\\u0044\\\\u0053\\\\u0046\\\\u0044,1,#".split(",");
        int length = split.length;
        int index = (length - 4) / 7;//总的长度减去指令中其他信息，算出有几组号码信息
        //存放所有的亲情号码信息
        List<Integer> sequenceList = new ArrayList<>();
        for (int j = 1; j <= index; j++) {
            sequenceList.add(Integer.parseInt(split[3 + (j - 1) * 7 + 1]));
        }

    }
}
